package m.framework.beans;

import m.Config;
import m.framework.utils.StringUtil;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.BeanFactory;

/**
 * @author ming
 * @date 2014年2月18日上午10:07:27
 */
public class MyBeanFactory {
	private static Logger log = LoggerFactory.getLogger(MyBeanFactory.class);
	private static BeanFactory springBeanFactory;
	
	public static <T> T getBean(Class<T> clazz){
		String id = StringUtil.firstLower(clazz.getSimpleName());
		return (T)springBeanFactory.getBean(id);
	}
	
	public static void init(BeanFactory factory){
		springBeanFactory=factory;
	}
}
